package miao.demo.dao;

import miao.demo.domain.Account;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface AccountDao {
    @Select("SELECT * FROM tbl_account")
    List<Account> findAll();

    @Select("SELECT * FROM tbl_account WHERE id = #{id}")
    Account findById(Integer id);

    @Insert("INSERT INTO tbl_account VALUES (null,#{name},#{money})")
    void save(Account account);

    @Delete("DELETE FROM tbl_account WHERE id=#{id}")
    void delete(Integer id);

    @Update("update tbl_account set name = #{name} , money = #{money} where id = #{id} ")
    void update(Account account);
}
